package com.demo.springcloud.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @author chenyuan
 * @date 2020/12/1 11:02
 */
@Configuration
public class ApplicationContextConfig {
	/**
	 * 将 RestTemplate 注入 Bean
	 */
	@Bean
	// 如果需要使用自定义的负载均衡规则，就要把这个去掉
	@LoadBalanced
	public RestTemplate getRestTemplate() {
		return new RestTemplate();
	}
}
